package tests;

import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.Socket;

public class TestClient {
	public static void main(String args[]){
		Socket socket;
		try {
			System.out.println("creating socket, connection to localhost on port 69999");
			socket = new Socket("192.168.0.197", 80);
			System.out.println("socket created!");
			InputStream inputStream = socket.getInputStream();
			ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
			Object messageObject = objectInputStream.readObject();
			if(messageObject instanceof Message){
				Message message = (Message)messageObject;
				System.out.println("got " + message.toString());
			}
			objectInputStream.close();
			inputStream.close();
			socket.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("test complete!");
	}
}
